//
// CVertexBufferReadWrite.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CUV;
import org.ryzom.nel.misc.CVector;

public class CVertexBufferReadWrite {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CVertexBufferReadWrite(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVertexBufferReadWrite obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CVertexBufferReadWrite(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CVertexBufferReadWrite() {
    this(nel3dJNI.new_CVertexBufferReadWrite(), true);
  }

  public void unlock() {
    nel3dJNI.CVertexBufferReadWrite_unlock(swigCPtr, this);
  }

  public void setVertexCoord(long idx, float x, float y, float z) {
    nel3dJNI.CVertexBufferReadWrite_setVertexCoord__SWIG_0(swigCPtr, this, idx, x, y, z);
  }

  public void setVertexCoord(long idx, CVector v) {
    nel3dJNI.CVertexBufferReadWrite_setVertexCoord__SWIG_1(swigCPtr, this, idx, CVector.getCPtr(v), v);
  }

  public void setNormalCoord(long idx, CVector v) {
    nel3dJNI.CVertexBufferReadWrite_setNormalCoord(swigCPtr, this, idx, CVector.getCPtr(v), v);
  }

  public void setTexCoord(long idx, short stage, float u, float v) {
    nel3dJNI.CVertexBufferReadWrite_setTexCoord__SWIG_0(swigCPtr, this, idx, stage, u, v);
  }

  public void setTexCoord(long idx, short stage, CUV uv) {
    nel3dJNI.CVertexBufferReadWrite_setTexCoord__SWIG_1(swigCPtr, this, idx, stage, CUV.getCPtr(uv), uv);
  }

  public void setColor(long idx, CRGBA rgba) {
    nel3dJNI.CVertexBufferReadWrite_setColor(swigCPtr, this, idx, CRGBA.getCPtr(rgba), rgba);
  }

  public void setSpecular(long idx, CRGBA rgba) {
    nel3dJNI.CVertexBufferReadWrite_setSpecular(swigCPtr, this, idx, CRGBA.getCPtr(rgba), rgba);
  }

  public void setWeight(long idx, short wgt, float w) {
    nel3dJNI.CVertexBufferReadWrite_setWeight(swigCPtr, this, idx, wgt, w);
  }

  public void setPaletteSkin(long idx, CPaletteSkin ps) {
    nel3dJNI.CVertexBufferReadWrite_setPaletteSkin(swigCPtr, this, idx, CPaletteSkin.getCPtr(ps), ps);
  }

  public void setValueFloat1Ex(CVertexBuffer.TValue valueId, long idx, float value) {
    nel3dJNI.CVertexBufferReadWrite_setValueFloat1Ex(swigCPtr, this, valueId.swigValue(), idx, value);
  }

  public void setValueFloat2Ex(CVertexBuffer.TValue valueId, long idx, float x, float y) {
    nel3dJNI.CVertexBufferReadWrite_setValueFloat2Ex(swigCPtr, this, valueId.swigValue(), idx, x, y);
  }

  public void setValueFloat3Ex(CVertexBuffer.TValue valueId, long idx, float x, float y, float z) {
    nel3dJNI.CVertexBufferReadWrite_setValueFloat3Ex__SWIG_0(swigCPtr, this, valueId.swigValue(), idx, x, y, z);
  }

  public void setValueFloat3Ex(CVertexBuffer.TValue valueId, long idx, CVector vector) {
    nel3dJNI.CVertexBufferReadWrite_setValueFloat3Ex__SWIG_1(swigCPtr, this, valueId.swigValue(), idx, CVector.getCPtr(vector), vector);
  }

  public void setValueFloat4Ex(CVertexBuffer.TValue valueId, long idx, float x, float y, float z, float w) {
    nel3dJNI.CVertexBufferReadWrite_setValueFloat4Ex(swigCPtr, this, valueId.swigValue(), idx, x, y, z, w);
  }

  public void setValueUChar4Ex(CVertexBuffer.TValue valueId, long idx, CRGBA rgba) {
    nel3dJNI.CVertexBufferReadWrite_setValueUChar4Ex(swigCPtr, this, valueId.swigValue(), idx, CRGBA.getCPtr(rgba), rgba);
  }

  public CVector getVertexCoordPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getVertexCoordPointer__SWIG_0(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new CVector(cPtr, false);
  }

  public CVector getVertexCoordPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getVertexCoordPointer__SWIG_1(swigCPtr, this);
    return (cPtr == 0) ? null : new CVector(cPtr, false);
  }

  public CVector getNormalCoordPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getNormalCoordPointer__SWIG_0(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new CVector(cPtr, false);
  }

  public CVector getNormalCoordPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getNormalCoordPointer__SWIG_1(swigCPtr, this);
    return (cPtr == 0) ? null : new CVector(cPtr, false);
  }

  public CUV getTexCoordPointer(long idx, short stage) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getTexCoordPointer__SWIG_0(swigCPtr, this, idx, stage);
    return (cPtr == 0) ? null : new CUV(cPtr, false);
  }

  public CUV getTexCoordPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getTexCoordPointer__SWIG_1(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new CUV(cPtr, false);
  }

  public CUV getTexCoordPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getTexCoordPointer__SWIG_2(swigCPtr, this);
    return (cPtr == 0) ? null : new CUV(cPtr, false);
  }

  public SWIGTYPE_p_void getColorPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getColorPointer__SWIG_0(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
  }

  public SWIGTYPE_p_void getColorPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getColorPointer__SWIG_1(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
  }

  public SWIGTYPE_p_void getSpecularPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getSpecularPointer__SWIG_0(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
  }

  public SWIGTYPE_p_void getSpecularPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getSpecularPointer__SWIG_1(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
  }

  public SWIGTYPE_p_float getWeightPointer(long idx, short wgt) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getWeightPointer__SWIG_0(swigCPtr, this, idx, wgt);
    return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
  }

  public SWIGTYPE_p_float getWeightPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getWeightPointer__SWIG_1(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
  }

  public SWIGTYPE_p_float getWeightPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getWeightPointer__SWIG_2(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
  }

  public CPaletteSkin getPaletteSkinPointer(long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getPaletteSkinPointer__SWIG_0(swigCPtr, this, idx);
    return (cPtr == 0) ? null : new CPaletteSkin(cPtr, false);
  }

  public CPaletteSkin getPaletteSkinPointer() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getPaletteSkinPointer__SWIG_1(swigCPtr, this);
    return (cPtr == 0) ? null : new CPaletteSkin(cPtr, false);
  }

  public SWIGTYPE_p_void getValueEx(CVertexBuffer.TValue valueId, long idx) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getValueEx__SWIG_0(swigCPtr, this, valueId.swigValue(), idx);
    return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
  }

  public SWIGTYPE_p_void getValueEx(CVertexBuffer.TValue valueId) {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getValueEx__SWIG_1(swigCPtr, this, valueId.swigValue());
    return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
  }

  public void touchVertices(long first, long last) {
    nel3dJNI.CVertexBufferReadWrite_touchVertices(swigCPtr, this, first, last);
  }

  public CVertexBuffer getParent() {
    long cPtr = nel3dJNI.CVertexBufferReadWrite_getParent(swigCPtr, this);
    return (cPtr == 0) ? null : new CVertexBuffer(cPtr, false);
  }

}
